﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Common;

namespace PCSWpfData.Extensions
{
    static class Extension
    {
        public static IQueryable<Instrument> CompleteInstruments(this CombinedDbContext context)
        {
            return context.Instruments
                .Include("PriceSeriesList.PriceList")
                .Include("PriceSeriesList.DividendList")
                .Include("PriceSeriesList.Statistic")
                .Include("PriceSeriesList");
            
        }

        public static Instrument InstrumentById(this CombinedDbContext context, int instrumentID)
        {
            return context.Instruments
                .Include("PriceSeriesList.PriceList")
                .Include("PriceSeriesList.DividendList")
                .Include("PriceSeriesList")
                .FirstOrDefault(c => c.Id == instrumentID);
        }


    }
}
